<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>computed</title>
</head>
<body>
<div id="app">
  <label>商品数量:</label><input v-model="count">
  <label>商品价格:</label><input v-model="price"><br>
  <label>商品总价:{{total}}

</div>

<script src="vue.global.js"></script>
<script>
  const App = {
    data(){
      return {
        count: 0,
        price: 0,
      }
    },
    computed: {
      total(){
        if (this.price < 0 || this.count < 9){
          return "error"
        }
        return this.count * this.price
      }

    }
  }

  const vm = Vue.createApp(App).mount('#app');
  console.log(vm)
</script>
</body>
</html>
